/* ══════════════════════════════════════════════════════
   ÉQUALISEUR — design glassmorphism aux couleurs du root
══════════════════════════════════════════════════════ */

/* ── Bouton discret dans le player ── */
#eq-toggle-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border, rgba(0,0,0,0.12));
  border-radius: 8px;
  background: var(--section2, transparent);
  color: var(--text-secondary, #888);
  font-size: .95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .22s;
  flex-shrink: 0;
  position: relative;
}
#eq-toggle-btn:hover {
  background: var(--primary);
  color: var(--btncolor);
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
#eq-toggle-btn.eq-active {
  background: var(--primary);
  color: var(--btncolor);
  border-color: transparent;
}
#eq-toggle-btn .eq-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--btncoloractive, #c59f21);
  display: none;
}
#eq-toggle-btn.eq-active .eq-dot { display: block; }

/* ── Backdrop ── */
#eq-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
#eq-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Panneau principal ── */
#eq-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--bottomplayercolor, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 2001;
  padding: 0;
  transform: translateY(20px) scale(.97);
  opacity: 0;
  pointer-events: none;
  transition: transform .32s cubic-bezier(.34,1.56,.64,1), opacity .28s ease;
  overflow: hidden;
}
body.dark-mode #eq-panel {
  background: rgba(27,26,26,.92);
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 24px 64px rgba(0,0,0,.45), 0 4px 16px rgba(0,0,0,.3);
}
#eq-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header panel ── */
.eq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,.08));
}
.eq-title-block { display: flex; align-items: center; gap: 10px; }
.eq-icon-wrap {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--btncolor);
  font-size: 1rem;
  flex-shrink: 0;
}
.eq-title {
  font-size: .92rem;
  font-weight: 800;
  color: var(--sectiontitlecolor, var(--textcolor, #1a1a1a));
  letter-spacing: -.01em;
}
.eq-subtitle {
  font-size: .68rem;
  color: var(--text-secondary, #888);
  margin-top: 1px;
  font-weight: 500;
}
.eq-close-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary, #888);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  transition: all .2s;
}
.eq-close-btn:hover {
  background: var(--primary);
  color: var(--btncolor);
  border-color: transparent;
}

/* ── Toggle ON/OFF ── */
.eq-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--section1, rgba(0,0,0,.02));
  border-bottom: 1px solid var(--border, rgba(0,0,0,.06));
}
.eq-toggle-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--textcolor, #1a1a1a);
}
.eq-power-switch {
  position: relative;
  width: 42px; height: 24px;
  cursor: pointer;
}
.eq-power-switch input { opacity: 0; width: 0; height: 0; }
.eq-power-slider {
  position: absolute; inset: 0;
  background: var(--border, #ddd);
  border-radius: 12px;
  transition: background .25s;
}
.eq-power-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.eq-power-switch input:checked + .eq-power-slider { background: var(--primary); }
.eq-power-switch input:checked + .eq-power-slider::before { transform: translateX(18px); }

/* ── Presets dispositifs ── */
.eq-presets-section {
  padding: 14px 20px 10px;
}
.eq-presets-title {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-secondary, #888);
  margin-bottom: 10px;
}
.eq-device-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.eq-device-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: 12px;
  background: var(--section2, transparent);
  color: var(--text-secondary, #888);
  cursor: pointer;
  transition: all .22s;
  font-family: inherit;
}
.eq-device-btn:hover {
  border-color: var(--primary);
  color: var(--textcolor, #1a1a1a);
  background: var(--section1, rgba(0,0,0,.02));
}
.eq-device-btn.active {
  background: var(--primary);
  color: var(--btncolor);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.eq-device-icon { font-size: 1.25rem; line-height: 1; }
.eq-device-label { font-size: .62rem; font-weight: 700; line-height: 1; white-space: nowrap; }

/* Sound style presets row */
.eq-style-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.eq-style-btn {
  padding: 5px 13px;
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary, #888);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  white-space: nowrap;
}
.eq-style-btn:hover {
  border-color: var(--primary);
  color: var(--textcolor, #1a1a1a);
}
.eq-style-btn.active {
  background: var(--primary);
  color: var(--btncolor);
  border-color: transparent;
}

/* ── Sliders EQ ── */
.eq-bands-section {
  padding: 14px 20px 10px;
  border-top: 1px solid var(--border, rgba(0,0,0,.06));
}
.eq-bands-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.eq-bands-title {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-secondary, #888);
}
.eq-reset-btn {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-secondary, #888);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 3px 8px;
  border-radius: 5px;
  transition: all .2s;
}
.eq-reset-btn:hover {
  background: var(--primary);
  color: var(--btncolor);
}

/* ── Conteneur des 8 bandes ── */
.eq-bands {
  display: flex;
  gap: 2px;
  align-items: stretch;
  height: 150px;
  padding: 0 2px;
}

/* ── Colonne par bande ── */
.eq-band {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.eq-band-value {
  font-size: .54rem;
  font-weight: 700;
  color: var(--textcolor, #1a1a1a);
  line-height: 1;
  height: 13px;
  white-space: nowrap;
  text-align: center;
}
.eq-band-value small { font-size: .38rem; font-weight: 500; opacity: .7; }

/* ── Zone slider verticale ── */
.eq-slider-wrap {
  flex: 1;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Track déco derrière le slider */
.eq-track-bg {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  top: 0; bottom: 0;
  border-radius: 4px;
  background: var(--border, rgba(0,0,0,.12));
  pointer-events: none;
}
.eq-track-fill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  border-radius: 4px;
  bottom: 0;
  background: linear-gradient(to top, var(--primary), var(--btncoloractive, #c59f21));
  opacity: .6;
  transition: height .12s ease;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────
   Slider VERTICAL natif via writing-mode
   Compatible Chrome 121+, Firefox, Safari 16+
   Pas de rotation — pas de débordement
───────────────────────────────────────────────────── */
.eq-band input[type=range] {
  writing-mode: vertical-lr;
  direction: rtl;                    /* min en bas, max en haut */
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;

  width: 20px;
  height: 100%;
  background: transparent;
  outline: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

/* Webkit — track */
.eq-band input[type=range]::-webkit-slider-container {
  height: 100%;
}
.eq-band input[type=range]::-webkit-slider-runnable-track {
  width: 4px;
  background: transparent;
  border-radius: 4px;
}
/* Webkit — thumb */
.eq-band input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2.5px solid var(--bottomplayercolor, #fff);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  margin-left: -7px;
}
.eq-band input[type=range]:hover::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 3px 12px rgba(0,0,0,.3);
}
.eq-band input[type=range]:active::-webkit-slider-thumb {
  transform: scale(1.05);
}

/* Firefox */
.eq-band input[type=range]::-moz-range-track {
  width: 4px;
  background: transparent;
  border-radius: 4px;
  border: none;
}
.eq-band input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2.5px solid var(--bottomplayercolor, #fff);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  cursor: pointer;
}

/* ── Label fréquence ── */
.eq-band-label {
  font-size: .5rem;
  font-weight: 600;
  color: var(--text-secondary, #888);
  text-align: center;
  white-space: nowrap;
  line-height: 1;
  height: 13px;
}
.eq-band-label small { font-size: .38rem; }

/* ── Barre d'actions sous les bandes ── */
.eq-bands-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding: 0 2px;
}
.eq-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: 10px;
  background: var(--section2, transparent);
  color: var(--text-secondary, #888);
  font-size: .7rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
  white-space: nowrap;
}
.eq-action-btn:hover {
  background: var(--primary);
  color: var(--btncolor);
  border-color: transparent;
}
.eq-action-btn.active {
  background: var(--primary);
  color: var(--btncolor);
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(0,0,0,.15);
}
.eq-action-btn svg { flex-shrink: 0; }

/* ── Footer gain ── */
.eq-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border, rgba(0,0,0,.06));
  display: flex;
  align-items: center;
  gap: 14px;
}
.eq-gain-label {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-secondary, #888);
  white-space: nowrap;
  flex-shrink: 0;
}
.eq-gain-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eq-gain-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: var(--border, rgba(0,0,0,.12));
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.eq-gain-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--btncolor, #fff);
  box-shadow: 0 1px 6px rgba(0,0,0,.18);
  cursor: pointer;
}
.eq-gain-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--btncolor, #fff);
  cursor: pointer;
}
.eq-gain-val {
  font-size: .72rem;
  font-weight: 700;
  color: var(--textcolor, #1a1a1a);
  min-width: 32px;
  text-align: right;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  #eq-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }
  .eq-device-presets { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .eq-bands { height: 120px; gap: 1px; }
  .eq-band input[type=range] { width: 18px; }
  .eq-band-value { font-size: .48rem; }
  .eq-band-label  { font-size: .44rem; }
  .eq-action-btn { font-size: .65rem; padding: 6px 8px; }
}
@media (max-width: 360px) {
  .eq-device-presets { grid-template-columns: repeat(2, 1fr); }
  .eq-bands { height: 110px; }
}

/* ── Footer icon ── */
.eq-footer-icon {
  color: var(--text-secondary, #888);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}